﻿
using System;

namespace GameServer.Network.ClientPackets
{
    abstract class ClientBasePacket
    {
        private byte[] _p;

        private int _index = 0;

        public ClientBasePacket(byte[] data)
        {
            _p = data;
            Run();
        }

        private abstract void Run();

        private byte ReadByte()
        {
            _index++;
            return _p[_index - 1];
        }

        private short ReadInt16()
        {
            _index += 2;
            return BitConverter.ToInt16(_p, _index - 2);
        }

        private int ReadInt32()
        {
            _index += 4;
            return BitConverter.ToInt32(_p, _index - 4);
        }

        private long ReadInt64()
        {
            _index += 8;
            return BitConverter.ToInt64(_p, _index - 8);
        }


    }
}
